<script setup>
import { ref, reactive } from 'vue'
import { UserFilled } from '@element-plus/icons-vue'
import { useRoute } from 'vue-router'
import { useRouter } from 'vue-router'
import { useUserStore } from '@/stores/user'
const router = useRouter()
const userStore = useUserStore()
function logout() {
  router.push('/login')
}
</script>

<template>
  <div class="title-wrapper">
    <div class="logo">水电控后台管理</div>
    <div class="user-info">
      <el-icon :size="18" color="white"><UserFilled /></el-icon>
      <span class="text">欢迎{{ userStore.userInfo.account || 'admin' }}</span>
      <span class="text" @click="logout">退出</span>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.title-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background-color: #1f45f0;
  .logo {
    width: 300px;
    height: 50px;
    line-height: 50px;
    font-size: 30px;
    font-family: 'PMZDR';
    color: white;
    letter-spacing: 12px;
    font-style: oblique;
  }
  .user-info {
    cursor: pointer;
    position: absolute;
    right: 30px;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    .text {
      margin-left: 10px;
      font-size: 16px;
      color: white;
    }
    &::before {
      content: '';
      position: absolute;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background-color: rgb(4, 233, 4);
      top: 50%;
      transform: translateY(-50%);
      left: -20px;
    }
  }
}
</style>
